package com.gxjc.action;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import com.gxjc.model.Nature;
import com.gxjc.service.NatureService;
import com.opensymphony.xwork2.ActionSupport;

public class NatureAction extends ActionSupport {
	@Resource
	NatureService natureService;
	public String name;
	public Integer max;
	public Integer min;
	public String tojsp;
	public List<Nature> list = new ArrayList<>();
	public String getAll(){
		list = natureService.getAll();
		return "success";
	}
	public String add(){
		Nature nature = new Nature();
		nature.setName(name);
		nature.setMax(max);
		nature.setMin(min);	
		natureService.save(nature);
		tojsp = "addNature.jsp";
		return SUCCESS;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Integer getMax() {
		return max;
	}
	public void setMax(Integer max) {
		this.max = max;
	}
	public Integer getMin() {
		return min;
	}
	public void setMin(Integer min) {
		this.min = min;
	}
	public List<Nature> getList() {
		return list;
	}
	public void setList(List<Nature> list) {
		this.list = list;
	}
	public String getTojsp() {
		return tojsp;
	}
	public void setTojsp(String tojsp) {
		this.tojsp = tojsp;
	}
	
}
